//
//  EarningsHeaderView.swift
//  LeTu
//
//  Created by g1 on 2023/12/30.
//

import UIKit

class EarningsHeaderView: UIView {

    override init(frame: CGRect) {
        super.init(frame: frame)
        
        configUI()
    }
    override func layoutSubviews() {
        super.layoutSubviews()
        
        DispatchQueue.main.async {
            self.lineView.addGradientLayer(gradientColors:  [UIColor(red: 1, green: 0.839, blue: 0, alpha: 1), UIColor(red: 0.851, green: 0.851, blue: 0.851, alpha: 0)], gradientDirection: .horizontally)
        }
    }
    
    // MARK: - configUI
    func configUI() {
        
        backgroundColor = .app_white
        
        addSubview(titleLabel)
        addSubview(lineView)
        
        titleLabel.snp.makeConstraints { make in
            make.left.equalTo(24)
            make.bottom.equalTo(-10)
        }
        lineView.snp.makeConstraints { make in
            make.centerX.equalTo(titleLabel)
            make.width.equalTo(titleLabel.snp.width).offset(-20)
            make.height.equalTo(4)
            make.top.equalTo(titleLabel.snp.bottom)
        }
        
    }
    private lazy var titleLabel: UILabel = {
        let titleLabel = UILabel()
        titleLabel.text = "收益记录".localized
        titleLabel.font = kSetPingFangRegular(17)
        return titleLabel
    }()
    private lazy var lineView: UIView = {
        let lineView = UIView()
        return lineView
    }()
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

}
